package com.htandroid.htandroid.webservice;

import com.htandroid.htandroid.entity.UffjqgdList_detail;
import com.htandroid.htandroid.sys.Basenvo;
import com.htandroid.htandroid.tools.ToolLog;

import java.util.ArrayList;

//生成xml的文本信息
public class BuildCgglcgdXMLService {

    public String buildXML(ArrayList<UffjqgdList_detail> cgdlist, String methodName, String namespace, String[] param, String[] val, String param_o) {
        String xmlstring = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>";
        //添加方法名
        xmlstring = xmlstring + "<" + methodName + " xmlns=\"" + namespace + "\"> \r\n";
        //前参
        for (int i = 0; i < param.length; i++) {
            xmlstring = xmlstring + "<" + param[i] + ">" + val[i] + "</" + param[i] + "> \r\n";
        }
        if (cgdlist != null) {
            //对象参数
            xmlstring = xmlstring + "<" + param_o + ">\r\n";
            for (int i = 0; i < cgdlist.size(); i++) {
                UffjqgdList_detail cgd = cgdlist.get(i);
                xmlstring = xmlstring + "<UffjqgdList_detail xmlns=\"http://entity.test.com\">\r\n";//必须指定映射文件所在的路径,否则webservice默认的是当前路径
                xmlstring = xmlstring + "<avgiprice1>" + Basenvo.AdjDigest(cgd.getAvgiprice1()) + "</avgiprice1>\r\n";
                xmlstring = xmlstring + "<avgiprice2>" + Basenvo.AdjDigest(cgd.getAvgiprice2()) + "</avgiprice2>\r\n";
                xmlstring = xmlstring + "<avgiquantity>" + Basenvo.AdjDigest(cgd.getAvgiquantity()) + "</avgiquantity>\r\n";
                xmlstring = xmlstring + "<bapprove>" + Basenvo.AdjDigest(cgd.getBapprove()) + "</bapprove>\r\n";
                xmlstring = xmlstring + "<bclose>" + Basenvo.AdjDigest(cgd.getBclose()) + "</bclose>\r\n";
                xmlstring = xmlstring + "<binvtype>" + Basenvo.AdjDigest(cgd.getBinvtype()) + "</binvtype>\r\n";
                xmlstring = xmlstring + "<canupdjxy>" + Basenvo.AdjDigest(cgd.getCanupdjxy()) + "</canupdjxy>\r\n";
                xmlstring = xmlstring + "<cchangedate>" + Basenvo.AdjDigest(cgd.getCchangedate()) + "</cchangedate>\r\n";
                xmlstring = xmlstring + "<ccheckdate>" + Basenvo.AdjDigest(cgd.getCcheckdate()) + "</ccheckdate>\r\n";
                xmlstring = xmlstring + "<cchecker>" + Basenvo.AdjDigest(cgd.getCchecker()) + "</cchecker>\r\n";
                xmlstring = xmlstring + "<cdefine1>" + Basenvo.AdjDigest(cgd.getCdefine1()) + "</cdefine1>\r\n";
                xmlstring = xmlstring + "<cdefine2>" + Basenvo.AdjDigest(cgd.getCdefine2()) + "</cdefine2>\r\n";
                xmlstring = xmlstring + "<cdefine3>" + Basenvo.AdjDigest(cgd.getCdefine3()) + "</cdefine3>\r\n";
                xmlstring = xmlstring + "<cdefine4>" + Basenvo.AdjDigest(cgd.getCdefine4()) + "</cdefine4>\r\n";
                xmlstring = xmlstring + "<cdepcode>" + Basenvo.AdjDigest(cgd.getCdepcode()) + "</cdepcode>\r\n";
                xmlstring = xmlstring + "<cdepname>" + Basenvo.AdjDigest(cgd.getCdepname()) + "</cdepname>\r\n";
                xmlstring = xmlstring + "<cdisapprovereason>" + Basenvo.AdjDigest(cgd.getCdisapprovereason()) + "</cdisapprovereason>\r\n";
                xmlstring = xmlstring + "<cinva_unit>" + Basenvo.AdjDigest(cgd.getCinva_unit()) + "</cinva_unit>\r\n";
                xmlstring = xmlstring + "<cinvaddcode>" + Basenvo.AdjDigest(cgd.getCinvaddcode()) + "</cinvaddcode>\r\n";
                xmlstring = xmlstring + "<cinvcode>" + Basenvo.AdjDigest(cgd.getCinvcode()) + "</cinvcode>\r\n";
                xmlstring = xmlstring + "<cinvm_unit>" + Basenvo.AdjDigest(cgd.getCinvm_unit()) + "</cinvm_unit>\r\n";
                xmlstring = xmlstring + "<cinvname>" + Basenvo.AdjDigest(cgd.getCinvname()) + "</cinvname>\r\n";
                xmlstring = xmlstring + "<cinvstd>" + Basenvo.AdjDigest(cgd.getCinvstd()) + "</cinvstd>\r\n";
                xmlstring = xmlstring + "<clvencode>" + Basenvo.AdjDigest(cgd.getClvencode()) + "</clvencode>\r\n";
                xmlstring = xmlstring + "<cnocheckreason>" + Basenvo.AdjDigest(cgd.getCnocheckreason()) + "</cnocheckreason>\r\n";
                xmlstring = xmlstring + "<cqgtype>" + Basenvo.AdjDigest(cgd.getCqgtype()) + "</cqgtype>\r\n";
                xmlstring = xmlstring + "<cvencode>" + Basenvo.AdjDigest(cgd.getCvencode()) + "</cvencode>\r\n";
                xmlstring = xmlstring + "<cvencode1>" + Basenvo.AdjDigest(cgd.getCvencode1()) + "</cvencode1>\r\n";
                xmlstring = xmlstring + "<cvencode2>" + Basenvo.AdjDigest(cgd.getCvencode2()) + "</cvencode2>\r\n";
                xmlstring = xmlstring + "<cvencodep1>" + Basenvo.AdjDigest(cgd.getCvencodep1()) + "</cvencodep1>\r\n";
                xmlstring = xmlstring + "<cvencodep2>" + Basenvo.AdjDigest(cgd.getCvencodep2()) + "</cvencodep2>\r\n";
                xmlstring = xmlstring + "<cvencodep3>" + Basenvo.AdjDigest(cgd.getCvencodep3()) + "</cvencodep3>\r\n";
                xmlstring = xmlstring + "<cvenname>" + Basenvo.AdjDigest(cgd.getCvenname()) + "</cvenname>\r\n";
                xmlstring = xmlstring + "<cvennamep1>" + Basenvo.AdjDigest(cgd.getCvennamep1()) + "</cvennamep1>\r\n";
                xmlstring = xmlstring + "<cvennamep2>" + Basenvo.AdjDigest(cgd.getCvennamep2()) + "</cvennamep2>\r\n";
                xmlstring = xmlstring + "<cvennamep3>" + Basenvo.AdjDigest(cgd.getCvennamep3()) + "</cvennamep3>\r\n";
                xmlstring = xmlstring + "<cvouchid>" + Basenvo.AdjDigest(cgd.getCvouchid()) + "</cvouchid>\r\n";
                xmlstring = xmlstring + "<cvouchnum>" + Basenvo.AdjDigest(cgd.getCvouchnum()) + "</cvouchnum>\r\n";
                xmlstring = xmlstring + "<ddate>" + Basenvo.AdjDigest(cgd.getDdate()) + "</ddate>\r\n";
                xmlstring = xmlstring + "<ddate_dh>" + Basenvo.AdjDigest(cgd.getDdate_dh()) + "</ddate_dh>\r\n";
                xmlstring = xmlstring + "<djcvencode>" + Basenvo.AdjDigest(cgd.getDjcvencode()) + "</djcvencode>\r\n";
                xmlstring = xmlstring + "<djprice>" + Basenvo.AdjDigest(cgd.getDjprice()) + "</djprice>\r\n";
                xmlstring = xmlstring + "<djtype>" + Basenvo.AdjDigest(cgd.getDjtype()) + "</djtype>\r\n";
                xmlstring = xmlstring + "<iamount>" + Basenvo.AdjDigest(cgd.getIamount()) + "</iamount>\r\n";
                xmlstring = xmlstring + "<ifrequency>" + Basenvo.AdjDigest(cgd.getIfrequency()) + "</ifrequency>\r\n";
                xmlstring = xmlstring + "<iinvexchrate>" + Basenvo.AdjDigest(cgd.getIinvexchrate()) + "</iinvexchrate>\r\n";
                xmlstring = xmlstring + "<iinvsprice>" + Basenvo.AdjDigest(cgd.getIinvsprice()) + "</iinvsprice>\r\n";
                xmlstring = xmlstring + "<ilprice>" + Basenvo.AdjDigest(cgd.getIlprice()) + "</ilprice>\r\n";
                xmlstring = xmlstring + "<ilquantity>" + Basenvo.AdjDigest(cgd.getIlquantity()) + "</ilquantity>\r\n";
                xmlstring = xmlstring + "<inorder>" + Basenvo.AdjDigest(cgd.getInorder()) + "</inorder>\r\n";
                xmlstring = xmlstring + "<inum>" + Basenvo.AdjDigest(cgd.getInum()) + "</inum>\r\n";
                xmlstring = xmlstring + "<iprice>" + Basenvo.AdjDigest(cgd.getIprice()) + "</iprice>\r\n";
                xmlstring = xmlstring + "<ipricep1>" + Basenvo.AdjDigest(cgd.getIpricep1()) + "</ipricep1>\r\n";
                xmlstring = xmlstring + "<ipricep2>" + Basenvo.AdjDigest(cgd.getIpricep2()) + "</ipricep2>\r\n";
                xmlstring = xmlstring + "<ipricep3>" + Basenvo.AdjDigest(cgd.getIpricep3()) + "</ipricep3>\r\n";
                xmlstring = xmlstring + "<iqgq>" + Basenvo.AdjDigest(cgd.getIqgq()) + "</iqgq>\r\n";
                xmlstring = xmlstring + "<iquantity>" + Basenvo.AdjDigest(cgd.getIquantity()) + "</iquantity>\r\n";
                xmlstring = xmlstring + "<isnum>" + Basenvo.AdjDigest(cgd.getIsnum()) + "</isnum>\r\n";
                xmlstring = xmlstring + "<precchecker>" + Basenvo.AdjDigest(cgd.getPrecchecker()) + "</precchecker>\r\n";
                xmlstring = xmlstring + "<qgdsid>" + Basenvo.AdjDigest(cgd.getQgdsid()) + "</qgdsid>\r\n";
                xmlstring = xmlstring + "<s_cdefine1>" + Basenvo.AdjDigest(cgd.getS_cdefine1()) + "</s_cdefine1>\r\n";
                xmlstring = xmlstring + "<s_cdefine2>" + Basenvo.AdjDigest(cgd.getS_cdefine2()) + "</s_cdefine2>\r\n";
                xmlstring = xmlstring + "<s_cdefine3>" + Basenvo.AdjDigest(cgd.getS_cdefine3()) + "</s_cdefine3>\r\n";
                xmlstring = xmlstring + "<s_cdefine4>" + Basenvo.AdjDigest(cgd.getS_cdefine4()) + "</s_cdefine4>\r\n";
                xmlstring = xmlstring + "<s_id>" + Basenvo.AdjDigest(cgd.getS_id()) + "</s_id>\r\n";
                xmlstring = xmlstring + "<succount>" + Basenvo.AdjDigest(cgd.getSuccount()) + "</succount>\r\n";
                xmlstring = xmlstring + "<venplatid>" + Basenvo.AdjDigest(cgd.getVenplatid()) + "</venplatid>\r\n";
                xmlstring = xmlstring + "</UffjqgdList_detail>\r\n";
            }
            xmlstring = xmlstring + "</" + param_o + ">\r\n";
        }
        xmlstring = xmlstring + "</" + methodName + ">\r\n";
        xmlstring = xmlstring + "</soap:Body></soap:Envelope>";
        return xmlstring;
    }
}
